package com.literature.search.core.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @ClassName User
 * @Description TODO
 * @Author abin
 * @Date 2023/2/22 23:42
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @ApiModelProperty(value = "id号")
    private String id;

    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "非空")
    @Field("user_name")
    private String userName;

    @ApiModelProperty(value = "密码")
    @Field("password")
    private String password;

    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "角色id")
    @Field("role_id")
    private Integer roleId;

    @ApiModelProperty(value = "邮箱")
    private String mail;

    @ApiModelProperty(value = "性别", notes = "0是未知,1是男，2是女")
    private Integer sex;

    @ApiModelProperty(value = "头像的GridfsId")
    private String avatar;

//    @ApiModelProperty(value = "头像")
//    private byte[] avatarContent;

    @ApiModelProperty(value = "封禁状态",notes = "管理员可以屏蔽掉某个用户，用户可以注销某个账号")
    private Boolean banning = false;

    @ApiModelProperty(value = "创建时间")
    @Field("create_date")
    private String createDate;

    @ApiModelProperty(value = "更新时间")
    @Field("update_date")
    private String updateDate;
}
